import { View, Text } from '@tarojs/components';
import { AtButton } from 'taro-ui';
import Checkbox from '@/components/Checkbox';
import './index.scss';

interface IProps {
  totalPrice: number;
  editMode?: boolean;
  onSelect: (e: boolean) => void;
  isAllSelected: boolean;
}

export default function ({
  totalPrice,
  editMode = false,
  onSelect = () => {},
  isAllSelected,
}: IProps) {
  return (
    <View className="bottom-btn">
      <View className="bottom-left">
        <Checkbox checked={isAllSelected} onChange={onSelect} />
        全选
      </View>
      {!editMode ? (
        <View className="bottom-right">
          <View className="flex-left">
            <View className="price">
              合计：
              <Text>￥{(totalPrice / 100).toFixed(2)}</Text>
            </View>
            <View className="desc">最终优惠金额见结算页面</View>
          </View>
          <View className="flex-right">
            <AtButton type="primary">结算</AtButton>
          </View>
        </View>
      ) : (
        <View className="bottom-right">
          <View className="flex-right">
            <AtButton type="primary">删除</AtButton>
          </View>
        </View>
      )}
    </View>
  );
}
